export const actions = {
  async nuxtServerInit({commit}, {app}) {
    
    // 地理定位
    const { 
      status, 
      data: {province, city}
    } = await app.$axios.get('/geo/getPosition')
    if(status === 200) {
      commit('geo/setPosition', {province, city})
    } else {
      commit('geo/setPosition', {
        province: '',
        city: ''
      })
    }

    // 首页分类菜单
    const {status:status2, data: {menu}} = await app.$axios.get('/geo/menu')
    if(status2 === 200) {
      commit('home/setMenu', menu)
    } else {
      commit('home/setMenu', [])
    }

    console.log(1)

    // 热门推荐
    // const {status:status3, data:{result}} = await app.$axios.get('/search/hotPlace',{
    //   params:{
    //     city:app.store.state.geo.position.city.replace('市','')
    //   }
    // })
    // commit('home/setHotPlace',status3===200?result:[])
  }
}

